Skip to content

fix(dashboard): show remaining totals in usage donuts#303

Open
Daltonganger wants to merge 4 commits intoSoju06:mainfrom
Daltonganger:fix/dashboard-remaining-total
Open

fix(dashboard): show remaining totals in usage donuts#303
Daltonganger wants to merge 4 commits intoSoju06:mainfrom
Daltonganger:fix/dashboard-remaining-total

Conversation

@Daltonganger
Copy link
Copy Markdown
Contributor

Summary

  • use aggregate remaining credits instead of aggregate capacity for the dashboard 5h and weekly usage donut totals
  • keep the donut center value aligned with the existing per-account remaining slices and the visible “Remaining” label
  • add a focused frontend regression test so the dashboard view does not fall back to capacity totals again

Testing

  • bun run test -- src/features/dashboard/utils.test.ts src/features/dashboard/components/usage-donuts.test.tsx
  • bun run lint -- src/features/dashboard/components/dashboard-page.tsx src/features/dashboard/utils.ts src/features/dashboard/utils.test.ts
  • bun run typecheck

@Soju06
Copy link
Copy Markdown
Owner

Soju06 commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec488ecb71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

? applySecondaryConstraint(rawPrimaryItems, secondaryUsageItems)
: rawPrimaryItems,
secondaryUsageItems,
primaryUsageTotal: overview.summary.primaryWindow.remainingCredits,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive primary donut total from constrained items

When the weekly window is tighter than the 5h window, applySecondaryConstraint reduces primaryUsageItems, but primaryUsageTotal still uses the unconstrained overview.summary.primaryWindow.remainingCredits. In that case the donut center ("Remaining") and consumed = total - usedSum become inconsistent with the displayed slices, so the chart overstates usable 5h remaining and introduces a synthetic consumed segment. Compute the total from the constrained primary items (or an equivalently constrained aggregate) so totals and slices stay aligned.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants